package main

import (
	"fmt"
	"os"
	"sync"
	"time"

	cpumassager "gitee.com/taotao_today/cpu-massager"
)

func main() {
	sysCPUCollector, err := cpumassager.NewSysCPUsageCollector(time.Second)
	if err != nil {
		fmt.Printf("NewSysCPUsageCollector error:%s\n", err.Error())
		os.Exit(1)
	}

	var wg sync.WaitGroup
	wg.Add(1)
	go func() {
		defer wg.Done()
		for {
			usageLinux := sysCPUCollector.GetCPUsage()
			fmt.Printf("usage from sysCPUCollector:%f\n", usageLinux)
		}
	}()
	wg.Wait()
	os.Exit(0)
}
